//
// Created by admin on 2022/7/29.
//

#import "UIImage+CYImageCategory.h"


@implementation UIImage (CYImageCategory)
+ (UIImage *)cy_imageWithColor:(UIColor *)color {
    CGSize size = CGSizeMake(1.0f, 1.0f);
    return [self cy_imageWithColor:color size:size];
}

+ (UIImage *)cy_imageWithColor:(UIColor *)color size:(CGSize)size {
    CGRect rect = CGRectMake(0, 0, size.width, size.height);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext(); return image;
}
@end